import React,{Component} from 'react';
import {HashRouter,Switch,Route,Redirect} from 'react-router-dom';

import TabbarPage from "../components/tabBarPage/index.jsx";
import HomeView from "../pages/HomePages/HomeView.jsx";
import CategoryView from "../pages/CategoryPages/CategoryView.jsx";
import CartView from "../pages/CartPages/CartView.jsx";
import DiscoveryView from "../pages/DiscoveryPages/DiscoveryView.jsx";
import UserView from "../pages/UserPages/UserView.jsx";
import GoodsDetailView from "../pages/GoodsPages/GoodsDetailView.jsx";


// Switch 只匹配一个  exact 精准匹配
export default class Routers extends Component{
  render() {
    return (
      <div>
        <HashRouter>
          <Switch>
            <Route path='/goodsDetailView' component={GoodsDetailView} />
            <Route path='/homeView' component={HomeView} />
            <Route path='/categoryView' component={CategoryView} />
            <Route path='/cartView' component={CartView} />
            <Route path='/discoveryView' component={DiscoveryView} />
            <Route path='/userView' component={UserView} />
            <Route path='/' component={HomeView} />
            <Redirect from="/" to="/home" />
          </Switch>
          <TabbarPage />
        </HashRouter>
      </div>
    )
  }
}